package com.songkun.template.refrofit.rx;


import com.songkun.template.config.AppApplication;
import com.songkun.template.utils.ILog;
import com.songkun.template.utils.NetworkUtil;

import rx.Observable;
import rx.Subscription;
import rx.plugins.RxJavaObservableExecutionHook;


/**
 * @author yelin.wu 16/3/23 上午10:53.
 * @description
 */
public class RxJavaExecutionHook extends RxJavaObservableExecutionHook {
    @Override
    public <T> Observable.OnSubscribe<T> onSubscribeStart(Observable<? extends T> observableInstance, Observable
            .OnSubscribe<T> onSubscribe) {
        ILog.e("RxJava 开始之前.....");
        if (NetworkUtil.isNotAvailable(AppApplication.getContext())) {
            ILog.e("当前没有网络....");

        }
        return super.onSubscribeStart(observableInstance, onSubscribe);
    }


    @Override
    public <T> Subscription onSubscribeReturn(Subscription subscription) {
        return super.onSubscribeReturn(subscription);
    }
}
